<!DOCTYPE html>
<html lang="en">
{% load staticfiles %}
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <img id="ware-image" src={% static ware %}>
    {% ifequal questionCount 0 %}
    <p>暂时没有人提问呢~</p>
    {% else %}
   {% for question, answerList in q_as.items %}
       <h2>{{ question }}</h2>
       {% for answer in answerList %}
            {{ answer }}
       {% endfor %}

   {% endfor %}
    {% endifequal %}
    <form method="post" id="question-form">
        <label for="question">有什么问题吗亲？</label>
        <input type="text" id="question" name="newQuestion">
        <input type="submit" value="提交啊亲~">
    </form>
    <script>
        Vue.component(
            {

            }
        )
        $("#question-form").submit(function () {
            var question = $("#question").val();
            $.ajaxSetup({
                data: {csrfmiddlewaretoken: '{{ csrf_token }}'}
            });
            $.ajax({
                type: "post",
                dataType: "json",
                url: "/ware/{{ ware.name|safe }}",
                data: {
                      'question': question
                    },
                success: function(data){
                    console.log("data: " + data);


                }

            })
        })
    </script>
</body>
</html>